package com.example.a2205douyin;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.example.a2205douyin.db.AppDBUtils;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMOptions;
import com.tencent.rtmp.TXLiveBase;
import com.tencent.rtmp.TXLiveBaseListener;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;

public class MyApp extends Application {
    public static Context context;

    public static Context getContext() {
        return context;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        UMConfigure.init(this, "5a12384aa40fa3551f0001d1", "umeng", UMConfigure.DEVICE_TYPE_PHONE, "");
        PlatformConfig.setQQZone("101830139","5d63ae8858f1caab67715ccd6c18d7a5");
        //初始化数据库
        AppDBUtils.getInstance().init(this);

        EMOptions options = new EMOptions();
        options.setAppKey("1104230426171869#im2205");

        EMClient.getInstance().init(context, options);

        String licenceURL = "https://license.vod2.myqcloud.com/license/v2/1327074420_1/v_cube.license"; // 获取到的 licence url
        String licenceKey = "48aa7c1880f9f706d26c042434976592"; // 获取到的 licence key
        TXLiveBase.getInstance().setLicence(this, licenceURL, licenceKey);
        TXLiveBase.setListener(new TXLiveBaseListener() {
            @Override
            public void onLicenceLoaded(int result, String reason) {
                Log.i("sss", "onLicenceLoaded: result:" + result + ", reason:" + reason);
            }
        });

    }
}
